<%@ page pageEncoding="utf-8"%>
<%-- 引入JSTL标签库 --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML>
<html>
<head>
	<title>订单详情</title>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<script type="text/javascript" src="/resources/js/jquery-1.11.3.min.js"></script>
	<script type="text/javascript" src="/resources/js/commons.js"></script>
	<script type="text/javascript" src="/resources/layer-v3.1.1/layer/layer.js"></script>
	<link rel="stylesheet" type="text/css" href="/resources/css/commons.css" />
</head>
<body>
<h2>订单详情</h2>
<hr/>
<form>
	<!-- hidden隐藏域,在提交表单时连order.id一起提交 -->
	<table border="1">
		<tr>
			<td width="30%">编号</td>
			<td>
				${ order.id }
			</td>
		</tr>
		<tr>
			<td width="30%">内容</td>
			<td>
				${ order.content }
			</td>
		</tr>
		<tr>
			<td width="30%">状态（-2已消单、-1已退单、0已下单、1已出单、2已成单、3已评价）</td>
			<td>
				<c:if test="${order.status eq 3}">
				<p>已评价<p>
				</c:if>
				<c:if test="${order.status eq 2}">
				<p>已成单<p>
				</c:if>
				<c:if test="${order.status eq 1}">
				<p>已出单<p>
				</c:if>
				<c:if test="${order.status eq 0}">
				<p>已下单<p>
				</c:if>
				<c:if test="${order.status eq -1}">
				<p>已退单<p>
				</c:if>
				<c:if test="${order.status eq -2}">
				<p>已消单<p>
				</c:if>
			</td>
		</tr>
		<tr>
			<td>用餐地点(0堂食，1外卖，2快递)</td>
			<td>
				<c:if test="${order.diningPlaceType eq 2}">
				<p>快递<p>
				</c:if>
				<c:if test="${order.diningPlaceType eq 1}">
				<p>外卖<p>
				</c:if>
				<c:if test="${order.diningPlaceType eq 0}">
				<p>堂食<p>
				</c:if>
			</td>
		</tr>
		<tr>
			<td>收货地址</td>
			<td>
				${ order.receiverAddress }
			</td>
		</tr>
		<tr>
			<td>收货人姓名</td>
			<td>
				${ order.receiverName }
			</td>
		</tr>
		<tr>
			<td>收货手机</td>
			<td>
				${ order.receiverMobile }
			</td>
		</tr>
		<tr>
			<td>收货备注</td>
			<td>
				${ order.receiverRemark }
			</td>
		</tr>
		<tr>
			<td>配送员姓名</td>
			<td>
				<c:if test="${order.status == 0}">
					<input id="deliverName" type="text" />
				</c:if>
				<c:if test="${order.status != 0}">
					${ order.deliverName }
				</c:if>
			</td>
		</tr>
		<tr>
			<td>配送员电话</td>
			<td>
				<c:if test="${order.status == 0}">
					<input id="deliverMobile" type="text" />
				</c:if>
				<c:if test="${order.status != 0}">
					${ order.deliverMobile }
				</c:if>
			</td>
		</tr>
		<tr>
			<td colspan="2">
				<c:if test="${order.status == 0}">
					<input type="button" value="出 单" onclick="startOrder('${ order.id }')" />
				</c:if>
				<c:if test="${order.status == 0 or order.status == -1}">
					<input type="button" value="消 单" onclick="cancelOrder('${ order.id }')" />
				</c:if>
			</td>
		</tr>
	</table>
</form>
<script type="text/javascript">

	function startOrder(orderId){
		var url = host + "/sys/update/starttime";
		var deliverName = $("#deliverName").val();
		var deliverMobile = $("#deliverMobile").val();
		var params = {"orderId": orderId, "deliverName": deliverName, "deliverMobile": deliverMobile};
		$.post(url, params, function (result) {
			window.location.href = host + "/sysOrderList";
		});
	}

	function cancelOrder(orderId){
		var url = host + "/sys/update/canceltime";
		var params = {"orderId": orderId};
		$.post(url, params, function (result) {
			window.location.href = host + "/sysOrderList";
		});
	}

</script>
</body>
</html>



